package com.buba.other.controller;


import com.buba.other.service.impl.PackageYpeServiceImpl;
import com.buba.other.service.impl.SetMealServiceImpl;
import com.buba.pojo.other.PackageYpe;
import com.buba.pojo.other.SetMeal;
import com.buba.pojo.user.Campus;
import com.buba.pojoVo.PackageYpeVo;
import com.buba.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 套餐类型表 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2022-06-09
 */
@RestController
@RequestMapping("/other/package-ype")
public class PackageYpeController {

    @Autowired
    private PackageYpeServiceImpl packageYpeService;

    @Autowired
    private SetMealServiceImpl setMealService;

    //
    @GetMapping({"getPackages"})
    public R getPackages() {
        List<PackageYpe> list = packageYpeService.getPackages();
        return list != null ? R.ok().data("list", list) : R.error();
    }

    @GetMapping({"getPackagesList/{packageId}"})
    public R getPackagesList(@PathVariable("packageId") Integer packageId) {

        List<SetMeal> list = setMealService.getPackagesList(packageId);
        return list != null ? R.ok().data("list", list) : R.error();
    }

}

